package com.ly.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ly.dao.UserRoleDao;
import com.ly.entity.UserRole;
import com.ly.rep.PageRequest;
import com.ly.service.UserRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class UserRoleServiceImpl implements UserRoleService {
    @Resource
    private UserRoleDao userRoleDao;
    @Override
    public PageInfo<UserRole> queryByPage(PageRequest<UserRole> pageRequest) {
        PageHelper.startPage(pageRequest.getPageNum(),pageRequest.getPageSize());
        List<UserRole> userRolesList = userRoleDao.selectAll(pageRequest.getQ());
        PageInfo<UserRole> userRolePageInfo = new PageInfo<>(userRolesList);
        return userRolePageInfo;
    }
}
